package com.mujin.keji.collectionsystem.module.outboundtask.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.mujin.keji.collectionsystem.R;
import com.mujin.keji.collectionsystem.module.outboundtask.dto.LabelsTypeDto;

import java.util.List;


/**
 * 标签适配器
 *
 * @author weishixiong
 * @Time 2018-05-12
 */
public class FimalyAdapter extends RecyclerView.Adapter<FimalyAdapter.ViewHolder> {
  //  private int[] photos = new int[]{R.drawable.image_self, R.drawable.image_direct, R.drawable.image_others};
    private Context mContext;
    private List<LabelsTypeDto> datas;


    public FimalyAdapter(Context context, List<LabelsTypeDto> datas) {
        mContext = context;
        this.datas = datas;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_label, null, false);
        ViewHolder viewHolder = new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tvName.setText(datas.get(position).getContent());
        //holder.tvName.setBackgroundResource(photos[datas.get(position).getType()]);
    }

    @Override
    public int getItemCount() {
        return datas == null ? 0 : datas.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        private TextView tvName;

        public ViewHolder(View itemView) {
            super(itemView);
            tvName = (TextView) itemView.findViewById(R.id.tv_name);
        }

        @Override
        public void onClick(View v) {

        }
    }
}
